package com.qf.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.entity.Diaries;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 日记(Diaries)表数据库访问层
 *
 * @author makejava
 * @since 2024-11-08 12:06:20
 */
@Mapper
public interface DiariesDao extends BaseMapper<Diaries> {


    /**
     * 修改日记内容
     *
     * @param diaries
     * @return
     */
    int updateDiaries(Diaries diaries);

    /**
     * 根据日记的每个属性来动态查询日记
     *
     * @param userId
     * @return
     */
    @Select("select *from t_diaries where user_id=#{userId} ")
    List<Diaries> selectByDiaries(Integer userId);

    //新建日记
    Integer insertDiary(Diaries diaries);

    // 根据日记Id来删除日记
    int deleteDiaryById(Diaries diaries);
}

